<?php

/*

Victory	$0 + 1 potion
 
 Worth 1 Victory Point for every 3 Action cards in your deck (rounded down).
 
 */

class Vineyard extends Card implements iVictory, iKingdom, iAlchemy {

    public function __construct() {
        $price = new Price(0, 1);
        parent::__construct("Vineyard", $price);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "Worth 1 Victory Point for every 3 Action cards in your deck (rounded down).");
    }
    
    public function play(Game $game, $isRealCard) {
        return true;
    }

    public function getVictoryPoints(Game $game, $name) {
        $all_cards = $game->getAllCards($name);
        $actions_num = 0;
        foreach ($all_cards as $card) {
            if ($card instanceof iAction) {
                $actions_num++;
            }
        }
        return (floor($actions_num/3));
    }
    
    public function boardSetup(Game $game) {
        $game->addPotion();
        return true;
    }
}
?>